// Include files.
#include "VersionPrinter.hpp"

using namespace std;

// Define "s_versionPrinterEntechFpk".
VersionPrinter *VersionPrinter::s_versionPrinterEntechFpk(NULL);

const VersionPrinter &VersionPrinter::GetEntechFpkVersionPrinter()
{
	if (s_versionPrinterEntechFpk == NULL)
	{
		s_versionPrinterEntechFpk = new VersionPrinter();
		
		s_versionPrinterEntechFpk->SetProductName("Entech-Fpk");
		
		// Add versions.
		s_versionPrinterEntechFpk->AddVersion(0, "None");
		s_versionPrinterEntechFpk->AddVersion(1, "Aztac c");
		s_versionPrinterEntechFpk->AddVersion(2, "Brownie");
		s_versionPrinterEntechFpk->AddVersion(3, "it doesn't crash any more; let's get Cupcakes!");
		s_versionPrinterEntechFpk->AddVersion(4, "ctrl-alt-Delete");
		s_versionPrinterEntechFpk->AddVersion(5, "the 5th Edition");
		s_versionPrinterEntechFpk->AddVersion(6, "Free edition");
		s_versionPrinterEntechFpk->AddVersion(7, "Guardian of awesomeness");
		s_versionPrinterEntechFpk->AddVersion(8, "Hope this works...");
	}
	
	return *s_versionPrinterEntechFpk;
}

VersionPrinter::~VersionPrinter()
{
}

void VersionPrinter::SetProductName(string name)
{
	m_nameProduct = name;
}

void VersionPrinter::AddVersion(int number, string name)
{
	m_namesVersion[number] = name;
}

void VersionPrinter::PrintVersion(int number) const
{
	if (m_namesVersion.count(number) > 0)
		printf("%s: Version %d \"%s\"\n", m_nameProduct.c_str(), number, (*(m_namesVersion.find(number))).second.c_str());
	else
		printf("%s: Version %d\n", m_nameProduct.c_str(), number);
}
